package com.sqx.modules.health.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.sqx.modules.health.entity.Hospital;
import com.sqx.modules.health.mapper.HospitalMapper;
import com.sqx.modules.health.service.IHospitalService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * <p>
 * 医院信息 服务实现类
 * </p>
 *
 * @author xglhappy
 * @since 2022-04-14
 */
@Service
public class HospitalServiceImpl extends ServiceImpl<HospitalMapper, Hospital> implements IHospitalService {

    @Autowired
    private HospitalMapper hospitalMapper;

    @Override
    public int filterHospital(String name) {
        return hospitalMapper.filterHospital(name);
    }

    @Override
    public Integer binding(String id, String uid, Integer status) {
        return hospitalMapper.binding(id,uid,status);
    }

    @Override
    public Long getHospitalId(String hospitalName) {
        return hospitalMapper.getHospitalId(hospitalName);
    }

    @Override
    public Integer saveUserDevice(String id, String uid) {
        return hospitalMapper.saveUserDevice(id, uid);
    }

    @Override
    public Integer unBinding(String id, Integer status) {
        return hospitalMapper.unBinding(id,status);
    }

    @Override
    public Integer delUserDevice(String id, String uid) {
        return hospitalMapper.delUserDevice(id, uid);
    }

    @Override
    public Long resultIdSave(Hospital hospital) {
        baseMapper.insert(hospital); // 执行新增操作
        return hospital.getId(); // 返回新增之后的id
    }
}
